package com.sansi.pencilbook.controller;

import com.sansi.pencilbook.DO.ResponseDO;
import com.sansi.pencilbook.DO.Result;
import com.sansi.pencilbook.service.AdminServer;
import com.sansi.pencilbook.util.ResponseDOUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 功能说明: 管理员接口
 *
 * @author lsy13
 */
@Slf4j
@RestController
@RequestMapping("/api/admin")
public class AdminController extends VerifyController implements BaseController{

    @Autowired
    private AdminServer adminServer;

    @PostMapping("/v/login")
    public ResponseDO login(@RequestParam("adminAccount") String adminAccount, @RequestParam("adminPassword") String adminPassword) {
        Result result = adminServer.login(adminAccount, adminPassword);
        return ResponseDOUtil.setResponseDO(result.isSuccess(), result.getMsg());
    }

}
